<?php
/*
 * emarket - a website to create your own online-shop.  
 * Copyright (C) 2009  Frédéric Delorme
 *
 * This file is part of emarket.
 *
 * emarket is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * emarket is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with emarket.  If not, see <http://www.gnu.org/licenses/>.
 *
 * To contact me: frederic.delorme@gmail.com
 * to see some information on te project : http://code.google.col/p/os-emarket/
 *
 */
/**
 * Form generation class: generate inline html formulare control with some
 * aggreagte informationsto standardize rendering.
 * @author frederic delorme
 */
class Forms{
	private $tabindex=null;
	public function start($name="",$manager="",$entity="",$id="",$defaultAction, $options=""){
		if(!empty($options['multipart'])){
			$multi=" enctype=\"multipart/form-data\"";
		}else{
			$multi="";
		}
		if(empty($options['method'])) $options['method']="POST";
		echo "<form id=\"id_$name\" class=\"forms\" name=\"$name\" method=\"".$options['method']."\"".
			 " action=\"".Html::encodeUrl($manager,$defaultAction,$entity,$id)."\"".
			 $multi. 
			 ">";
	}
	public function end($name){
		echo "</form>";
	}
	
	public function startFieldDelimiter($styleclass=""){
		return "<div class=\"".($styleclass!=""?$styleclass:"field")."\" >";
	}
	public function endFieldDelimiter(){
		return "</div>";
	}
	
	public function __construct(){
		$this->tabindex=1;
	}
}
?>